package com.ikun.search.controller;

import com.ikun.common.entity.Department;
import com.ikun.common.entity.Docker;
import com.ikun.common.entity.PageEntity;
import com.ikun.search.service.DepartmentService;
import com.ikun.search.service.DockerService;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * ES搜索 前端控制器
 *
 * @author Guio
 * @since 2024-02-26
 */
@RestController
@RequestMapping("search")
public class DockerController {

    @Resource
    private DockerService dockerService;

    /**
     * 初始化docker索引
     */
    @GetMapping("init")
    public String init() {
        dockerService.initDockerIndex();
        return "ok";
    }

    /**
     * 搜索医生
     */
    @PostMapping("docker")
    public ResponseEntity<PageEntity<Docker>> searchDocker(@RequestBody Map<String, String> map) {
        PageEntity<Docker> pageEntity = dockerService.searchDocker(map);
        return ResponseEntity.ok(pageEntity);
    }

}
